{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/design-hashmap\n",
    "\n",
    "\n",
    "Runtime: 104 ms, faster than 92.93% of C++ online submissions for Design HashMap.\n",
    "Memory Usage: 45.8 MB, less than 88.04% of C++ online submissions for Design HashMap.\n",
    "\n",
    "\n",
    "\n",
    "```cpp\n",
    "#include <unordered_map>\n",
    "\n",
    "using namespace std;\n",
    "\n",
    "class MyHashMap {\n",
    "public:\n",
    "    /** Initialize your data structure here. */\n",
    "    unordered_map<int, int> umap;\n",
    "    MyHashMap() {\n",
    "        \n",
    "    }\n",
    "    \n",
    "    /** value will always be non-negative. */\n",
    "    void put(int key, int value) {\n",
    "       umap[key] = value; \n",
    "    }\n",
    "    \n",
    "    /** Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key */\n",
    "    int get(int key) {\n",
    "       if (umap.find(key) != umap.end()) {\n",
    "           return umap[key];\n",
    "       } else {\n",
    "           return -1;\n",
    "       }\n",
    "    }\n",
    "    \n",
    "    /** Removes the mapping of the specified value key if this map contains a mapping for the key */\n",
    "    void remove(int key) {\n",
    "       unordered_map<int, int>::iterator i = umap.find(key);\n",
    "       if (i != umap.end()) {\n",
    "           umap.erase(i);\n",
    "       } \n",
    "    }\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
